#include "benchmark.h"
#include "insertion_sort.h"

void insertionSort(int a[], int n) {
	int i, j, v;
	for (i=0; i<n; i++) {
		v = a[i];
		j = i-1;
		while (j >= 0 && benchAddOperation(benchmark) && a[j] > v) {
			a[j+1] = a[j];
			j = j-1;
		}
		a[j+1] = v;
	}
}